//
//  SYJMoreProductCollectionViewCell.m
//  JieJieKan
//
//  Created by 极速现金侠 on 2017/7/6.
//  Copyright © 2017年 innext. All rights reserved.
//

#import "SYJMoreProductCollectionViewCell.h"
//#import "UIImage+Additions.h"
//#import "SYJTradeListMode.h"

@interface SYJMoreProductCollectionViewCell ()
@property (nonatomic , weak) UIImageView *imagelogoView;
@property (nonatomic , weak) UILabel *mainTitleLab;
@property (nonatomic , weak) UILabel *titleLab;
@property (nonatomic , weak) UILabel *subTitleLab;
@end

@implementation SYJMoreProductCollectionViewCell
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self){
        
        self.backgroundColor = [UIColor whiteColor];
    
        self.mainTitleLab = [JSLKitFactory jsl_labelWithFrame:CGRectZero text:@"pao" font:MEDIUM_FONT(12) textColor:[@"#666666" hexStringToColor] textAlignment:NSTextAlignmentCenter SuperView:self.contentView];
        
        self.titleLab = [JSLKitFactory jsl_labelWithFrame:CGRectZero text:@"运动" font:LIGHT_FONT(10) textColor:[@"#666666" hexStringToColor] textAlignment:NSTextAlignmentLeft SuperView:self.contentView];
        
        self.subTitleLab = [JSLKitFactory jsl_labelWithFrame:CGRectZero text:@"发挥好地方" font:LIGHT_FONT(10) textColor:[@"#666666" hexStringToColor] textAlignment:NSTextAlignmentLeft SuperView:self.contentView];
        self.imagelogoView = [JSLKitFactory jsl_imageViewWithFrame:CGRectZero imageName:@"" superView:self.contentView];
        
    
        
    }
    return self;
}
- (void)configMoreProduc:(NSDictionary *)productDict{
//    {
//        highAmount = 5000;
//        hotDesc = "\U8f7b\U677e\U501f\U94b1\U4e0d\U6c42\U4eba";
//        hotTag = "0\U62b5\U62bc\U624b\U673a\U53ef\U501f";
//        productId = 20;
//        productLogo = "http://www.jieduoqian.com/image/d87f1108-755c-4e25-ba5a-5d0163540449.jpg";
//        productName = "\U5feb\U8d37";
//    }
    self.mainTitleLab.text = [NSString stringWithFormat:@"#%@#",productDict[@"hotDesc"]];
    [self.imagelogoView sd_setImageWithURL:[NSURL URLWithString:productDict[@"productLogo"]] placeholderImage:nil];
    self.titleLab.text = productDict[@"productName"];
    self.subTitleLab.text = [NSString stringWithFormat:@"最高%@元",productDict[@"highAmount"]];
    self.titleLab.text = productDict[@"productName"];
[self configFrom];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    
    
    [self configFrom];
    
//    self.imagelogoView.backgroundColor = [UIColor redColor];

  
}

- (void)configFrom {
    CGSize mainSize = [self.mainTitleLab.text sizeWithAttributes:@{NSFontAttributeName:self.mainTitleLab.font}];
    self.mainTitleLab.frame = CGRectMake(0, 9*AutoSizeScaleXX, CGRectGetWidth(self.frame), mainSize.height);
    
    self.imagelogoView.frame = CGRectMake(10*AutoSizeScaleXX, CGRectGetMaxY(self.mainTitleLab.frame)+10*AutoSizeScaleXX, 36*AutoSizeScaleXX, 36*AutoSizeScaleXX);
    
    CGSize titleSize = [self.titleLab.text sizeWithAttributes:@{NSFontAttributeName:self.titleLab.font}];
    self.titleLab.frame = CGRectMake(CGRectGetMaxX(self.imagelogoView.frame)+5*AutoSizeScaleXX, CGRectGetMinY(self.imagelogoView.frame)+3*AutoSizeScaleYY, titleSize.width, titleSize.height);
    
    CGSize subSize = [self.subTitleLab.text sizeWithAttributes:@{NSFontAttributeName : self.subTitleLab.font}];
    
    self.subTitleLab.frame = CGRectMake(CGRectGetMinX(self.titleLab.frame), CGRectGetMaxY(self.imagelogoView.frame)-subSize.height-3*AutoSizeScaleYY, subSize.width, subSize.height);
}
@end
